package enums;

import java.util.Arrays;

/**
 * @Classname EnumSeason
 * @Description 枚举类的第二种写法
 * @Date 2023/1/26 13:31
 * @Created by louzhuangxi
 */
public enum EnumSeason implements myInterface {
    SPRING("春天", "春暖花开"){
        @Override
        public void show() {

        }
    },
    SUMMER("夏天", "夏日炎炎") {
        @Override
        public void show() {

        }
    },
    AUTUMN("秋天", "秋高气爽") {
        @Override
        public void show() {

        }
    },
    WINTER("冬天", "白雪皑皑") {
        @Override
        public void show() {

        }
    };
    private String seasonName;
    private String seasonContent;

    EnumSeason(String seasonName, String seasonContent) {
        this.seasonName = seasonName;
        this.seasonContent = seasonContent;
    }

    public String getSeasonName() {
        return seasonName;
    }

    public String getSeasonContent() {
        return seasonContent;
    }

}

interface myInterface {
    public void show();
}

class EnumSeasonTest {
    public static void main(String[] args) {
        EnumSeason[] values = EnumSeason.values();
        for (EnumSeason value : values) {
            String seasonName = value.getSeasonName();
            String seasonContent = value.getSeasonContent();
            System.out.println(seasonName);
            System.out.println(seasonContent);
            value.show();
        }

        System.out.println("****************************");
        Arrays.stream(values).filter(t -> t.getSeasonName().equals("春天")).map(t -> t.getSeasonName()).forEach(System.out::println);
    }
}
